<?php

if ( !class_exists( "BME_pattern" ) ) {
require_once("Feature.php");

class BME_pattern extends BME_feature {
	
	var $sequence;		// int	ID of query sequence.
	var $hitStart;		// int	Start of hit.
	var $hitEnd;		// int	End of hit.
	var $patternName;	// str	Pattern name.
	var $pattern;		// str	Pattern sequence.
	var $hitSequence;	// str	Hit sequence.
	
	/**
	 * bme_pattern new bme_pattern([int id]);
	 * @param mix int (optional): The ID on Lcl-DB.
	 * @return bme_pattern (object).
	 */
	function BME_pattern($id=NULL) {
		parent::__construct($id);
	}
	/**
	 * bool load(int id);
	 * @param int id.
	 * @return bool: success.
	 */
	function load($id){
		$out=false;
		$this->openDB();
		$res=$this->DBquery("select * from `PatternResult` where `idPatternResult`='$id'");
		if($row=$this->DBfetch_assoc($res)){
			$this->id = (int)$row["idPatternResult"];
			foreach($row as $k=>$v) $this->{$k} = $v;
			$this->sequence=(int)$row["Sequence_idSequence"];
			$this->hitStart=(int)$row["hitStart"];
			$this->hitEnd=(int)$row["hitEnd"];
		}
		$this->closeDB();
		return $out;
	}
	/**
	 * int getid(void);
	 * @return int: Id.
	 */
	function getId(){
		assert('isset($this->id)');
		return $this->id.".".$this->version;
	}
	/**
	 * str getname(void);
	 * @return str: Name.
	 */
	function getName(){
		assert('isset($this->id)');
		return $this->patternName;
	}
	/**
	 * str getpattern(void);
	 * @return str: Pattern.
	 */
	function getPattern(){
		assert('isset($this->id)');
		return $this->pattern;
	}
}

}


?>
